import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import ArticleDetail from '../views/ArticleDetail.vue'
import CategoryDetail from '../views/CategoryDetail.vue'
import CategoryList from '../views/CategoryList.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/article/:id',
    name: 'ArticleDetail',
    component: ArticleDetail,
    props: true
  },
  {
    path: '/category/:id',
    name: 'CategoryDetail',
    component: CategoryDetail,
    props: true
  },
  {
    path: '/category/:id/page/:pageNumber',
    name: 'CategoryDetailPaged',
    component: CategoryDetail,
    props: true
  },
  {
    path: '/categories',
    name: 'CategoryList',
    component: CategoryList
  },
  {
    path: '/articles/page/:pageNumber',
    name: 'ArticleListPaged',
    component: Home,
    props: true
  },
  ]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})


export default router